export default {
  namespace: 'piaoji',

  state: {
    list: [],
    NewPage: 1,
  },

  effects: {
    *Refresh(action, { put, select }) {
      let NewPage = select(state => state.piaoji.NewPage);
      let url = `/api/client/group_view/1.json?page=${NewPage}`;
      let response = yield fetch(url);
      let res = yield response.json();
      yield put({ type: 'setList', list: res });
    },
  },

  reducers: {
    setList(state, action) {
      return Object.assign({}, state, {
        list2: action.list,
      });
    },
  },
};
